﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI.WebControls;

namespace JqueryNet.FormControl.FormWebControl
{
    public class JPanel : JWebControl
    {
        Panel panel;
        public JPanel(Panel panel)
            : base(panel)
        {
            this.panel = panel;
        }

        public override void Attr(string key)
        {
            switch (key.ToLower())
            {
                case "height":
                    Value = panel.Height;
                    return;
                case "width": Value = panel.Width;
                    return;
                case "title":
                case "tooltip": Value = panel.ToolTip;
                    return;
                default:
                    base.Attr(key);
                    return;
            }
        }

        public override void Attr(string key, string value)
        {
            int b;
            int.TryParse(value, out b);
            switch (key.ToLower())
            {
                case "height":
                    panel.Height = b;
                    return;
                case "width": panel.Width = b;
                    return;
                case "title":
                case "tooltip": panel.ToolTip = value;
                    return;
                default:
                    base.Attr(key, value);
                    return;
            }
        }
    }
}
